package com.tianyu.service.mqtt.model.dto;

import com.alibaba.fastjson2.JSONObject;
import lombok.Builder;
import lombok.Data;

/**********************************
 * @Author YSW
 * @Description 机场无人机实时推送数据
 * @Date 2024/7/31 - 18:06
 **********************************/

@Data
@Builder
public class StateResponse {

    private String areaCode = "440311";

    private String messageType;

    private Long timestamp;

    private String messages;

    public static StateResponse newUavState(Object object){
        return StateResponse.builder()
                .areaCode("440311")
                .messageType("UAV_REALTIME_INFO")
                .timestamp(System.currentTimeMillis())
                .messages(JSONObject.from(object).toJSONString())
                .build();
    }

    public static StateResponse newDockState(Object object){
        return StateResponse.builder()
                .areaCode("440311")
                .messageType("DOCK_REALTIME_INFO")
                .timestamp(System.currentTimeMillis())
                .messages(JSONObject.from(object).toJSONString())
                .build();
    }
}
